/**
    @author: ChenLin
    @date: 2022/11/11 todo 视频截图工具类
**/

package handler

import "strconv"

/**
 * @Author ChenLin
 * @Description //TODO 命令行运行ffmpeg截图命令
 * @Date 14:34 2022/11/11
 **/

func FfmpegScreenShot(fileUrl string, second int, imageUrl string) error {
	//ffmpeg -i d0e4ad395784372b8d7fac4fc320236b.mp4 -ss 10 -frames:v 1 test.jpg
	var arg []string
	arg = append(arg, "-i", fileUrl, "-ss", strconv.Itoa(second), "-frames:v", "1", imageUrl)
	err := RunFfmpegCmd(arg...)
	if err != nil {
		return err
	}
	return nil
}
